﻿using GrainManage.Entities.Encrypt;
using GrainManage.Server.Business;
using System.Web.Mvc;

namespace GrainManage.Server.Controllers
{
    public class EncryptController : BaseController
    {
        private readonly EncryptBusiness business = new EncryptBusiness();

        //************************************************POST************************************************
        [HttpPost]
        public ActionResult DesDecrypt(InputDesDecrypt input)
        {
            var result = business.DesDecrypt(input);
            return NewtonsoftJson(result);
        }

        [HttpPost]
        public ActionResult DesEncrypt(InputDesEncrypt input)
        {
            var result = business.DesEncrypt(input);
            return NewtonsoftJson(result);
        }

        [HttpPost]
        public ActionResult Md5Encrypt(InputMd5Encrypt input)
        {
            var result = business.Md5Encrypt(input);
            return NewtonsoftJson(result);
        }

        [HttpPost]
        public ActionResult RsaDecrypt(InputRsaDecrypt input)
        {
            var result = business.RsaDecrypt(input);
            return NewtonsoftJson(result);
        }

        [HttpPost]
        public ActionResult RsaEncrypt(InputRsaEncrypt input)
        {
            var result = business.RsaEncrypt(input);
            return NewtonsoftJson(result);
        }

        [HttpPost]
        public ActionResult GetPublicKey(InputGetPublicKey input)
        {
            var result = business.GetPublicKey(input);
            return NewtonsoftJson(result);
        }
    }
}
